module(...,package.seeall)

local estadoCombo = 0
local objects = require("game_objects")

local function fimTempoDeCombo(event)

	if (estadoCombo > 0) then
		estadoCombo = estadoCombo - 1
	end
end

function combo:acaoCombo(currentScore, m_point)

	if (m_point > 0) then 
		if (estadoCombo >= 2) then
			currentScore = currentScore + m_point * 3
			estadoCombo = 0
            objects.newTelaCheck("combo", "")
		else
			estadoCombo = estadoCombo + 1
			currentScore = currentScore + m_point
		end
		timer.performWithDelay(1000, fimTempoDeCombo)
	else
		currentScore = currentScore + m_point
		estadoCombo = 0
	end
    
	return currentScore
end
